﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using jiaju.Models;
using jiaju.Models.DBModel;
namespace jiaju.Models.DAL
{
    public class BannerService
    {
        public static List<Banner> getBannerList()
        {
            string sql = "select Title,ImgUrl,ToUrl from banner";
            List<Banner> list = new List<Banner>();
            SqlDataReader sdr = DBHelp.ExecuteReader(sql);
            while (sdr.Read())
            {
                string title = (string)sdr["Title"];
                string imgUrl = (string)sdr["ImgUrl"];
                string toUrl = (string)sdr["ToUrl"];
                Banner banner = new Banner() { Title = title, ImgUrl = imgUrl, ToUrl= toUrl };
                list.Add(banner);
            }
            return list;
        }
    }
}